﻿using B.S.Data.MES.API.Applications.QualityManagement.ExamineProjectCommand.Commands;
using B.S.Domain.BasicData.QualityManagement;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.QualityManagement.ExamineProjectCommand.CommandHandlers
{
    public class GetQueryTypeCommandHandler : IRequestHandler<GetQueryTypeCommand, APIRequst<List<ExamineType>>>
    {
        private readonly IBaseRepository<ExamineType> _examinetypeRepository;
        public GetQueryTypeCommandHandler(IBaseRepository<ExamineType> examinetypeRepository)
        {
            _examinetypeRepository = examinetypeRepository;
        }
        public Task<APIRequst<List<ExamineType>>> Handle(GetQueryTypeCommand request, CancellationToken cancellationToken)
        {
            APIRequst<List<ExamineType>> result = new APIRequst<List<ExamineType>>();

            result.Code = RequstCode.成功;
            result.Msg = RequstCode.成功.ToString();

            var list=_examinetypeRepository.GetAll().Where(x=>!x.isDel);

            result.Data =list.ToList();
            return Task.FromResult(result);

        }
    }
}
